package org.cx.oa.dao.impl;

import java.util.List;

import org.cx.oa.base.BaseDaoImpl;
import org.cx.oa.dao.ConnectionTypeInfo;
import org.cx.oa.entity.Employee;
import org.cx.oa.entity.PersonalCommunication;
import org.cx.oa.util.BeanFactory;
import org.hibernate.Session;

public class PersonalCommunicationInfoImpl extends BaseDaoImpl<PersonalCommunication> implements ConnectionTypeInfo<PersonalCommunication> {

	@Override
	public void save(PersonalCommunication obj) {
		// TODO Auto-generated method stub
		super.save(obj);
	}

	@Override
	public void update(PersonalCommunication obj) {
		// TODO Auto-generated method stub
		super.update(obj);
	}

	@Override
	public void delete(PersonalCommunication obj) {
		// TODO Auto-generated method stub
		super.delete(obj);
	}

	@Override
	public List<PersonalCommunication> findAll() {
		// TODO Auto-generated method stub
		return super.findAll();
	}

	@Override
	public PersonalCommunication findById(int id) {
		// TODO Auto-generated method stub
		return super.findById(id);
	}

	@Override
	public List<PersonalCommunication> getByIdList(Integer[] idList) {
		// TODO Auto-generated method stub
		return super.getByIdList(idList);
	}

	@Override
	public Session getSession() {
		// TODO Auto-generated method stub
		return super.getSession();
	}
	
	public List<PersonalCommunication> select(int ConnectionId,int EmployeeId){
		
		@SuppressWarnings("unchecked")
		List<PersonalCommunication> list = getSession().createQuery("from "+BeanFactory.getImpl(PersonalCommunication.class).getClass().getName()+" where ConnectionId="+ConnectionId+"and EmployeeId="+EmployeeId).list();
		return list;
	}
	
	public List<PersonalCommunication> selectPC(int employeeId){
		
		@SuppressWarnings("unchecked")
		List<PersonalCommunication> list = getSession().createQuery("from "+BeanFactory.getImpl(PersonalCommunication.class).getClass().getName()+" where EmployeeId="+employeeId).list();
		return list;
	}
	
	public Employee getEmployee(int employeeId){
		
		Employee employee = (Employee) getSession().createQuery("from "+BeanFactory.getImpl(Employee.class).getClass().getName()+" where UserId="+employeeId);
		return employee;
	}
}
